﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CycleTimeReport.CApCTRTimer
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.Generic;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.CycleTimeReport;

public class CApCTRTimer
{
  public CApCTRTimer(
    string name,
    int originalEventIndex,
    double startTime,
    double endTime,
    double duration,
    string description,
    object eventObject1,
    object eventObject2,
    object eventObject3,
    TxRobot robot,
    bool timerIsStoppedInTheMiddle = false)
  {
    this.Name = name;
    this.OriginalEventIndex = originalEventIndex;
    this.StartTime = startTime;
    this.EndTime = endTime;
    this.ActiveDuration = duration;
    this.Description = description;
    this.Object1 = eventObject1;
    this.Object2 = eventObject2;
    this.Object3 = eventObject3;
    this.Robot = robot;
    this.TimerIsStoppedInTheMiddle = timerIsStoppedInTheMiddle;
  }

  public override string ToString()
  {
    string str = "StartTime " + CApCTRUtilities.DoubleToString(this.StartTime, "f3", true) + ";" + "EndTime " + CApCTRUtilities.DoubleToString(this.EndTime, "f3", true) + ";" + "Name " + this.Name + ";" + "ActiveDuration " + CApCTRUtilities.DoubleToString(this.ActiveDuration, "f3", true) + ";";
    if (this.Object1 != null && this.Object1 is ITxObject && (this.Object1 as ITxObject).IsValid())
      str = $"{str}  {(this.Object1 as ITxObject).Name}";
    if (this.Object2 != null && this.Object2 is ITxObject && (this.Object2 as ITxObject).IsValid())
      str = $"{str}  {(this.Object2 as ITxObject).Name}";
    if (this.Object3 != null && this.Object3 is ITxObject && (this.Object3 as ITxObject).IsValid())
      str = $"{str}  {(this.Object3 as ITxObject).Name}";
    return str;
  }

  public virtual double ComputeEndTime() => this.StartTime + this.ActiveDuration;

  public virtual string InactiveDurationToString()
  {
    return CApCTRUtilities.GetResourceManager().GetString("NA_STRING");
  }

  public virtual string PriorityToString()
  {
    return CApCTRUtilities.GetResourceManager().GetString("NA_STRING");
  }

  internal List<string> AdditionalInfo { get; set; }

  internal string Name { get; set; }

  internal int OriginalEventIndex { get; set; }

  internal double StartTime { get; set; }

  internal double EndTime { get; set; }

  internal double ActiveDuration { get; set; }

  internal string Description { get; set; }

  internal object Object1 { get; set; }

  internal object Object2 { get; set; }

  internal object Object3 { get; set; }

  internal TxRobot Robot { get; set; }

  internal bool TimerIsStoppedInTheMiddle { get; set; }
}
